package com.njtoyo.taxi.admin.library.payment.cmb.file.http;

import cn.hutool.core.lang.Assert;

import static java.util.Objects.requireNonNull;

public class RequestConfig {

    private final String appId;

    private final String appSecret;

    private final String verify;

    private final String version;

    private final String privateKey;

    public String getAppId() {
        return appId;
    }

    public String getAppSecret() {
        return appSecret;
    }

    public String getVerify() {
        return verify;
    }

    public String getVersion() {
        return version;
    }

    public String getPrivateKey() {
        return privateKey;
    }

    private RequestConfig(String appId, String appSecret, String verify, String version, String privateKey) {
        this.appId = appId;
        this.appSecret = appSecret;
        this.verify = verify;
        this.version = version;
        this.privateKey = privateKey;
    }

    public static class Builder {

        private String appId;
        private String appSecret;
        private String verify;
        private String version;
        private String privateKey;

        public Builder appId(String appId) {
            this.appId = appId;
            return this;
        }

        public Builder appSecret(String appSecret) {
            this.appSecret = appSecret;
            return this;
        }

        public Builder verify(String verify) {
            this.verify = verify;
            return this;
        }

        public Builder version(String version) {
            this.version = version;
            return this;
        }

        public Builder privateKey(String privateKey) {
            this.privateKey = privateKey;
            return this;
        }

        public RequestConfig build() {
            Assert.notBlank(appId);
            Assert.notBlank(appSecret);
            Assert.notBlank(verify);
            Assert.notBlank(version);
            Assert.notBlank(privateKey);

            return new RequestConfig(appId, appSecret, verify, version, privateKey);
        }
    }
}
